package com.lekang.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.lekang.common.annotation.Log;
import com.lekang.common.core.controller.BaseController;
import com.lekang.common.core.domain.AjaxResult;
import com.lekang.common.enums.BusinessType;
import com.lekang.domain.CheckContent;
import com.lekang.service.ICheckContentService;
import com.lekang.common.utils.poi.ExcelUtil;
import com.lekang.common.core.page.TableDataInfo;

/**
 * 入住信息检查Controller
 * 
 * @author wjy
 * @date 2025-10-17
 */
@RestController
@RequestMapping("/checkcontent/checkcontent")
public class CheckContentController extends BaseController
{
    @Autowired
    private ICheckContentService checkContentService;

    /**
     * 查询入住信息检查列表
     */
    @PreAuthorize("@ss.hasPermi('checkcontent:checkcontent:list')")
    @GetMapping("/list")
    public TableDataInfo list(CheckContent checkContent)
    {
        startPage();
        List<CheckContent> list = checkContentService.selectCheckContentList(checkContent);
        return getDataTable(list);
    }

    /**
     * 导出入住信息检查列表
     */
    @PreAuthorize("@ss.hasPermi('checkcontent:checkcontent:export')")
    @Log(title = "入住信息检查", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, CheckContent checkContent)
    {
        List<CheckContent> list = checkContentService.selectCheckContentList(checkContent);
        ExcelUtil<CheckContent> util = new ExcelUtil<CheckContent>(CheckContent.class);
        util.exportExcel(response, list, "入住信息检查数据");
    }

    /**
     * 获取入住信息检查详细信息
     */
    @PreAuthorize("@ss.hasPermi('checkcontent:checkcontent:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(checkContentService.selectCheckContentById(id));
    }

    /**
     * 新增入住信息检查
     */
    @PreAuthorize("@ss.hasPermi('checkcontent:checkcontent:add')")
    @Log(title = "入住信息检查", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody CheckContent checkContent)
    {
        return toAjax(checkContentService.insertCheckContent(checkContent));
    }

    /**
     * 修改入住信息检查
     */
    @PreAuthorize("@ss.hasPermi('checkcontent:checkcontent:edit')")
    @Log(title = "入住信息检查", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody CheckContent checkContent)
    {
        return toAjax(checkContentService.updateCheckContent(checkContent));
    }

    /**
     * 删除入住信息检查
     */
    @PreAuthorize("@ss.hasPermi('checkcontent:checkcontent:remove')")
    @Log(title = "入住信息检查", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(checkContentService.deleteCheckContentByIds(ids));
    }
}
